// 贪心；时间复杂度O(n)；空间复杂度O(s)，s为字符集长度58

class Solution {
public:
    int longestPalindrome(string s) {
        int arr[58] = {0};
        int ret = 0;
        for (auto& c: s) {
            arr[c - 'A']++;
        }
        for (auto& val: arr) {
            if (ret % 2 == 0 && val % 2 == 1){
                ret++;
            }
            ret += val / 2 * 2;
        }
        return ret;
    }
};